﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace JMT.Controls.Commands
{
    public class CompositeCommand : ICommand
    {
        public List<ICommand> _commands = new List<ICommand>();
        public CompositeCommand(ICommand command1, ICommand command2)
        {
            _commands.Add(command1);
            _commands.Add(command2);
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            foreach (var command in _commands)
            {
                command.Execute(parameter);
            }
        }
    }
}
